GetExpand

The GetExpand method retrieves a named value of data type REG_EXPAND_SZ, REG_DWORD, or REG_SZ from a specified registry key. When a REG_EXPAND_SZ named value is retrieved, the method expands any embedded environment variables.

Syntax

GetExpand(FullKeyValueName)

Parameters

FullKeyValueName
A string that specifies the named value. This string should consist of a key name followed by a value name. For example, to specify the value MyValue stored in the key HKLM\Software\MyCompany, you would use the following string:

HKLM\Software\MyCompany\MyValue

The key portion of this parameter can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:

\\RemoteMachine\HKLM\Software\MyProg

Return Value

A string that contains the retrieved named value. Any embedded environment variables, such as %SystemRoot%, are replaced with their expanded values.

Example

The following example retrieves the named value LogFileDirectory from the registry key HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\. The example uses the Get method to retrieve LogFileDirectory without expanding the environment variables and then uses the GetExpand method to retrieve the named value and include expanded environment variables.
<% 
Set Reg = Server.CreateObject("IISSample.Registry")
 
LFD = Reg.Get("HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\LogFileDirectory") 
 
LFDEX = Reg.GetExpand("HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\LogFileDirectory") 
%>
LogFileDirectory = <%= LFD %><br>
LogFileDirectory Expanded = <%= LFDEX %>
 

If in the preceding example the environment variable %SystemRoot% has the value D:\Winnt and the value stored in LogFileDirectory is %SystemRoot%\System32\LogFiles\, the output would be:
LogFileDirectory = %SystemRoot%\System32\LogFiles\
LogFileDirectory Expanded = D:\Winnt\System32\LogFiles\
 

Applies To

Registry Access Component

See Also

Get, SetExpand